#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int y,m,d;
int main(void){
    while(~scanf("%d/%d/%d",&y,&m,&d)){
        int ans=d;
        if(y%4==0 && y%100!=0 || y%400==0){
            if(m>=3){
                ans+=1;
            }
        }
        if(m==2){
            ans+=31;
        }
        else if(m==3){
            ans+=(31+28);
        }
        else if(m==4){
            ans+=(31+28+31);
        }
        else if(m==5){
            ans+=(31+28+31+30);
        }
        else if(m==6){
            ans+=(31+28+31+30+31);
        }
        else if(m==7){
            ans+=(31+28+31+30+31+30);
        }
        else if(m==8){
            ans+=(31+28+31+30+31+30+31);
        }
        else if(m==9){
            ans+=(31+28+31+30+31+30+31+31);
        }
        else if(m==10){
            ans+=(31+28+31+30+31+30+31+31+30);
        }
        else if(m==11){
            ans+=(31+28+31+30+31+30+31+31+30+31);
        }
        else if(m==12){
            ans+=(31+28+31+30+31+30+31+31+30+31+30);
        }
        printf("%d\n",ans);
    }
    return 0;
}
